import API from "./API";
import http from './http';


/**
 * 获取首页列表
 */
function UserLogin(param) {
    return new Promise((resolve, reject) => {
        http("post", API.WT_User_Login, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

/**
 * 获取用户信息
 */
function GetUserDetails(param) {
    return new Promise((resolve, reject) => {
        http("post", API.WT_user_details, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

/**
 * 在栏----编号查询
 * */
function GetColumnSearch(param) {
    return new Promise((resolve, reject) => {
        http("post", API.WT_leave_enter_Info_listPage, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

/**
 * 入栏添加-上传图片
 * */
function UploadImage(param) {
    return new Promise((resolve, reject) => {
        http("put", API.WT_image_getImageUrl, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

/**
 * 入栏添加
 * */
function SaveLeaveEnterInfo(param) {
    return new Promise((resolve, reject) => {
        http("post", API.WT_leave_enter_redis_save, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

/**
 * 获取缓存列表
 * */
function GetLeaveEnterInfoList(param) {
    return new Promise((resolve, reject) => {
        http("post", API.WT_leave_enter_redis_getLeaveEnterInfoList, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

/**
 * 删除--出栏缓存
 * */
function LeaveEnterRedisDeleteLeave(param) {
    return new Promise((resolve, reject) => {
        http("post", API.WT_leave_enter_redis_deleteLeave, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

/**
 * 删除--入栏缓存
 * */
function LeaveEnterRedisDelete(param) {
    return new Promise((resolve, reject) => {
        http("post", API.WT_leave_enter_redis_delete, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

/**
 * 出栏--获取出栏添加详情
 * */
function GetOutSlaughterAddDetail(param){
    return new Promise((resolve, reject) => {
        http("post", API.WT_leave_enter_Info_details, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

/**
 * 成本统计
 * */
function AnalyseCount(param) {
    return new Promise((resolve, reject) => {
        http("post", API.WT_leave_enter_order_analyseCount, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

/**
 * 添加入栏信息
 * */
function SaveEnter(param) {
    return new Promise((resolve, reject) => {
        http("post", API.WT_leave_enter_Info_saveEnter, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

/**
 * 添加出栏信息
 * */
function SaveLeave(param) {
    return new Promise((resolve, reject) => {
        http("post", API.WT_leave_enter_Info_saveLeave, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

/**
 * 获取种类列表
 * */
function GetEnterVarietyList(param) {
    return new Promise((resolve, reject) => {
        http("post", API.WT_enter_variety_list, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

/**
 * 添加出栏信息
 * */
function SaveSickness(param) {
    return new Promise((resolve, reject) => {
        http("post", API.WT_sickness_info_save, param).then(res => {
            resolve(res);
        }, error => {
            console.log("网络异常~", error);
            reject(error)
        })
    })
}

export {
    UserLogin,
    GetUserDetails,
    GetColumnSearch,
    UploadImage,
    GetLeaveEnterInfoList,
    SaveLeaveEnterInfo,
    AnalyseCount,
    LeaveEnterRedisDeleteLeave,
    GetOutSlaughterAddDetail,
    SaveEnter,
    LeaveEnterRedisDelete,
    SaveLeave,
    GetEnterVarietyList,
    SaveSickness
}

